 <? 
include_once('../inc/functions.php');
require_once('../inc/global.php');
require_once('inc/user_userdata.php');
        $result = Users::GetAll();
?>
<? 
	include('inc/header.php')
?>
<title>Users</title>
</head>
<body>
<? 
	include('inc/adminnav.php')
?>
<div class="contentstuff">
<h2>Users</h2>
        <a href="edit.php">Add</a>
        <table>
                <tr>
                <th width="175px" align="left">First Name</th>
                <th width="175px" align="left">Last Name</th>
                <th width="175px" align="left">PictureURL</th>
                <th width="175px" align="left">FBID</th>
                <th width="175px" align="left">Lookup_id</th>
            </tr>
                        <? while($rs = $result->fetch_assoc()){ ?>
                <? include 'inc/Users_det.php'; ?>
            <? } ?>
            <tr>
                <td id="insert" colspan="6">
                </td>
            </tr>
        </table>
        <script type="text/javascript">
                $(function(){
                        $.get("edit.php?IsAjax=1", function(data){
                                $("#insert").html(data);
                        });
                        $(".AjaxLink").bind('click', LoadForm);
                        $("form").live('submit', function(){
                                var f = this;
                                var formVars = $(this).serialize();
                                $.post(this.action, formVars, function(data){
                                        var tr = $(f).closest("tr");
                                        tr.replaceWith(data);
                                        tr.find(".AjaxLink").bind('click', LoadForm);

                                });
                                return false;
                        })
                });
                function LoadForm(){
                                var a = this;
                                $.get(this.href, {IsAjax:true}, function(data){
                                        var tr = $(a).closest("tr");
                                        tr.find("td").hide();
                                        var temp = $("<td colspan='6' />").appendTo(tr);
                                        temp.html(data);
                                        //$("#insert").html(data);
                                        temp.find(".cancel").click(function(){
                                                temp.remove();
                                                tr.find("td").show();
                                        })
                                });
                                return false;
                        }
                </script>
        </div>
</body>
</html>
<? //$conn->close(); ?>